package com.rui.study.micro.msgcenter.controller;

import com.rui.study.commons.model.Result;
import com.rui.study.commons.util.JsonUtil;
import com.rui.study.micro.msgcenter.model.SmsSendingInfo;
import com.rui.study.micro.msgcenter.util.StatusCode;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @program: study
 * @description:
 * @author: Yaowr
 * @create: 2018-11-07 16:48
 **/
@RestController
@RefreshScope
public class MsgController {

    @GetMapping("/v1/test")
    public Result<String> SmsSdk(@ModelAttribute SmsSendingInfo smsSendingInfo) {
        return new Result<>(StatusCode.SUCCEED, JsonUtil.encode(smsSendingInfo));
    }
    @PostMapping("/v2/test")
    public Result<String> SmsSdk2(@RequestBody SmsSendingInfo smsSendingInfo) {
        return new Result<>(StatusCode.SUCCEED, JsonUtil.encode(smsSendingInfo));
    }

    @PostMapping("/v1/test/feign")
    public Result testFeign(@RequestBody Map<String, Object> body) {
        System.out.println(body);
        return new Result(StatusCode.SUCCEED);
    }

}
